/*
* 真正的编程应该从堆栈(内存)分析开始
*   堆 Heap
*   栈 Stack
*
*   -----都是从电脑内存条中分配出来的内存
*
*
* 上下文  EC [execution context]  执行上下文
*   GO Global Object
*   VO / AO  Variable Object / A
*
* */

/*
var a = 12;
var b = a;
b = 13;
console.log(a);//12

function fn1() {
    var a = 12;
    var b = a;
    b = 13;
    console.log(a);//12
}
fn1();*/

/*

var a = {
    n:12
};
var b = a;
b["n"] = 13;//b.n = 13   成员访问
console.log(a.n);//13
*/


/*var a = {
    n:12
};
var b = a;
b = {
    n:13
};
console.log(a.n);*/




/*{
    //a.x 成员访问 优先级最高
    //正常从右到左
    // let a = b = 10;
    //创建10
    //b->10
    //a->10

    let a = {};

    // a.x = a = 12;
    // a.x = 12
    // a = 12
}*/


// 思考:
var a = {
    n: 10
};
var b = a;
a.x = a = {
    n: 20
};
console.log(a.x);//undefined
console.log(b);//{
                // n:10,
                //     {x:20}
            // }










